package com.unience.ec2.eclipse.dialog;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.SWT;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class GrantAccessDialog extends org.eclipse.swt.widgets.Dialog {

	private Shell dialogShell;
	private Label label1;
	private Composite composite2;
	private Text textCIRD;
	private Label labelCIRD;
	private Button buttonCancel;
	private Button buttonAccept;
	private Composite composite4;
	private Composite composite1;
	private Text textTo;
	private Label label4;
	private Text text1;
	private Label label3;
	private Combo comboProtocol;
	private Combo comboSource;
	
	
	boolean accepted = false;
	String cird;
	String portFrom;
	String portTo;
	private Label labelProtocol;
	private Composite composite3;
	String protocol;
	String userId;
	String group;

	/**
	* Auto-generated main method to display this 
	* org.eclipse.swt.widgets.Dialog inside a new Shell.
	*/
	public static void main(String[] args) {
		try {
			Display display = Display.getDefault();
			Shell shell = new Shell(display);
			GrantAccessDialog inst = new GrantAccessDialog(shell, SWT.NULL);
			inst.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public GrantAccessDialog(Shell parent, int style) {
		super(parent, style);
	}

	public void open() {
		try {
			Shell parent = getParent();
			dialogShell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);

			dialogShell.setLayout(new FormLayout());
			dialogShell.layout();
			dialogShell.pack();			
			dialogShell.setSize(347, 435);
			{
				FormData composite2LData = new FormData();
				composite2LData.width = 234;
				composite2LData.height = 50;
				composite2LData.left =  new FormAttachment(0, 1000, 12);
				composite2LData.top =  new FormAttachment(0, 1000, 86);
				composite2 = new Composite(dialogShell, SWT.NONE);
				GridLayout composite2Layout = new GridLayout();
				composite2Layout.numColumns = 2;
				composite2.setLayout(composite2Layout);
				composite2.setLayoutData(composite2LData);
				{
					labelCIRD = new Label(composite2, SWT.NONE);
					labelCIRD.setText("CIRD");
				}
				{
					textCIRD = new Text(composite2, SWT.NONE);
					GridData textCIRDLData = new GridData();
					textCIRDLData.widthHint = 180;
					textCIRDLData.heightHint = 17;
					textCIRD.setLayoutData(textCIRDLData);
					textCIRD.setText("0.0.0.0/0");
				}
			}
			{
				buttonCancel = new Button(dialogShell, SWT.PUSH | SWT.CENTER);
				buttonCancel.setText("Cancel");
				FormData buttonCancelLData = new FormData();
				buttonCancelLData.width = 55;
				buttonCancelLData.height = 29;
				buttonCancelLData.left =  new FormAttachment(0, 1000, 227);
				buttonCancelLData.top =  new FormAttachment(0, 1000, 356);
				buttonCancel.setLayoutData(buttonCancelLData);
			}
			{
				buttonAccept = new Button(dialogShell, SWT.PUSH | SWT.CENTER);
				buttonAccept.setText("Accept");
				FormData buttonAcceptLData = new FormData();
				buttonAcceptLData.width = 56;
				buttonAcceptLData.height = 29;
				buttonAcceptLData.left =  new FormAttachment(0, 1000, 165);
				buttonAcceptLData.top =  new FormAttachment(0, 1000, 356);
				buttonAccept.setLayoutData(buttonAcceptLData);
			}
			{
				FormData composite1LData = new FormData();
				composite1LData.width = 296;
				composite1LData.height = 180;
				composite1LData.left =  new FormAttachment(0, 1000, 0);
				composite1LData.top =  new FormAttachment(0, 1000, 159);
				composite1 = new Composite(dialogShell, SWT.NONE);
				GridLayout composite1Layout = new GridLayout();
				composite1Layout.makeColumnsEqualWidth = true;
				composite1.setLayout(composite1Layout);
				composite1.setLayoutData(composite1LData);
				{
					labelProtocol = new Label(composite1, SWT.NONE);
					labelProtocol.setText("Protocol Details");
				}
				{
					comboProtocol = new Combo(composite1, SWT.NONE|SWT.BORDER);
					GridData comboProtocolLData = new GridData();
					comboProtocolLData.widthHint = 252;
					comboProtocolLData.heightHint = 29;
					comboProtocol.setLayoutData(comboProtocolLData);
					comboProtocol.setItems(new java.lang.String[] {"tcp","udp","icmp"});
					
				}
				{
					GridData composite3LData = new GridData();
					composite3LData.widthHint = 322;
					composite3LData.heightHint = 21;
					composite3 = new Composite(composite1, SWT.NONE);
					GridLayout composite3Layout = new GridLayout();
					composite3Layout.numColumns = 2;
					composite3.setLayout(composite3Layout);
					composite3.setLayoutData(composite3LData);
					{
						label3 = new Label(composite3, SWT.NONE);
						GridData label3LData = new GridData();
						label3LData.widthHint = 132;
						label3LData.heightHint = 17;
						label3.setLayoutData(label3LData);
						label3.setText("From Port");
					}
					{
						text1 = new Text(composite3, SWT.NONE);
						GridData text1LData = new GridData();
						text1LData.widthHint = 99;
						text1LData.heightHint = 17;
						text1.setLayoutData(text1LData);
						text1.setText("0");
					}
				}
				{
					GridData composite4LData = new GridData();
					composite4LData.widthHint = 336;
					composite4LData.heightHint = 45;
					composite4 = new Composite(composite1, SWT.NONE);
					GridLayout composite4Layout = new GridLayout();
					composite4Layout.numColumns = 2;
					composite4.setLayout(composite4Layout);
					composite4.setLayoutData(composite4LData);
					{
						label4 = new Label(composite4, SWT.NONE);
						GridData label4LData = new GridData();
						label4LData.widthHint = 136;
						label4LData.heightHint = 17;
						label4.setLayoutData(label4LData);
						label4.setText("To Port");
					}
					{
						textTo = new Text(composite4, SWT.NONE);
						GridData textToLData = new GridData();
						textToLData.widthHint = 97;
						textToLData.heightHint = 17;
						textTo.setLayoutData(textToLData);
						textTo.setText("65535");
					}
				}
			}
			{
				comboSource = new Combo(dialogShell, SWT.NONE|SWT.BORDER);
				FormData comboSourceLData = new FormData();
				comboSourceLData.width = 223;
				comboSourceLData.height = 29;
				comboSourceLData.left =  new FormAttachment(0, 1000, 15);
				comboSourceLData.top =  new FormAttachment(0, 1000, 39);
				comboSource.setLayoutData(comboSourceLData);
				comboSource.setItems(new java.lang.String[] {"CIRD","Users and Groups"});
			}
			{
				label1 = new Label(dialogShell, SWT.NONE);
				label1.setText("Source");
				FormData label1LData = new FormData();
				label1LData.width = 70;
				label1LData.height = 17;
				label1LData.left =  new FormAttachment(0, 1000, 12);
				label1LData.top =  new FormAttachment(0, 1000, 12);
				label1.setLayoutData(label1LData);
			}
			dialogShell.setLocation(getParent().toDisplay(100, 100));
			dialogShell.open();
			Display display = dialogShell.getDisplay();
			while (!dialogShell.isDisposed()) {
				if (!display.readAndDispatch())
					display.sleep();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public boolean isAccepted() {
		return accepted;
	}

	public void setAccepted(boolean accepted) {
		this.accepted = accepted;
	}

	public String getCird() {
		return cird;
	}

	public void setCird(String cird) {
		this.cird = cird;
	}

	public String getPortFrom() {
		return portFrom;
	}

	public void setPortFrom(String portFrom) {
		this.portFrom = portFrom;
	}

	public String getPortTo() {
		return portTo;
	}

	public void setPortTo(String portTo) {
		this.portTo = portTo;
	}

	public String getProtocol() {
		return protocol;
	}

	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}
	
}
